home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
t3_1
/
risc_src.lha
/
risc_sources
/
xlib
/
interface.t
< prev
next >
Wrap
Text File
|
1990-06-07
|
2KB
|
78 lines
(herald interface (env tsys))
(define (bytev-append . args)
(let ((len (do ((args args (cdr args))
(len 0 (fx+ len (bytev-length (car args)))))
((null? args) len))))
(let ((new (make-bytev len)))
(iterate loop ((args args) (i 0))
(cond ((null? args) new)
(else
(let* ((bytev (car args))
(len (bytev-length bytev)))
(do ((j 0 (fx+ j 1)))
((fx>= j len)
(loop (cdr args) (fx+ i len)))
(set (bref new (fx+ i j)) (bref bytev j))))))))))
(define (sub-bytev x begin end)
(let* ((size (fx- end begin))
(new (make-bytev size)))
(do ((i 0 (fx+ i 1)))
((fx>= i size) new)
(set (bref new i) (bref x (fx+ begin i))))))
(define-constant (c->extend x)
(gc-pair->extend (gc-pair->extend x)))
(define-constant (->extend x)
(if (fixnum? x)
(c->extend x)
x))
(define (mref-8-u x i)
(bref-8-u (->extend x) i))
(define (mref-16-u x i)
(bref-16-u (->extend x) i))
(define (mref-16-s x i)
(bref-16-s (->extend x) i))
(define (mref-integer x i)
(bref-32 (->extend x) i))
(define (set-mref-8-u! x i val)
(set (bref-8-u (->extend x) i) val))
(define (set-mref-16-u! x i val)
(set (bref-16-u (->extend x) i) val))
(define (set-mref-16-s! x i val)
(set (bref-16-s (->extend x) i) val))
(define (set-mref-integer! x i val)
(set (bref-32 (->extend x) i) val))
(define (mref-pointer x i)
(extend-elt (->extend x) (fixnum-ashr i 2)))
(define (set-mref-pointer! x i val)
(set (extend-elt (->extend x) (fixnum-ashr i 2)) val))
(define (bit-or . args)
(do ((args args (cdr args))
(val 0 (fixnum-logior val (car args))))
((null? args) val)))
(define (bit-and . args)
(do ((args args (cdr args))
(val 0 (fixnum-logand val (car args))))
((null? args) val)))
(define bit-xor fixnum-logxor)
(define bit-not fixnum-lognot)